﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using LogManager.Base;
using LogManager.Base.Data;
using LogManager.Base.Models;

namespace LogManager.Config.Data
{
    public class ConfigEventTypeService : IEventTypeService
    {
        private readonly IEnumerable<EventTypeConfiguration> _eventTypes;

        public ConfigEventTypeService(EventTypeCollection eventTypeCollection)
        {
            _eventTypes = eventTypeCollection.Cast<EventTypeConfiguration>();
        }

        #region IEventTypeService Members

        public  IEnumerable<IEventType> All()
        {
            return _eventTypes;
        }

        public IEventType Get(string typeId)
        {
            return _eventTypes.Where(t => t.TypeId == typeId).SingleOrDefault();
        }

        #endregion

        
    }
}